package com.jasontools.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import com.wondertek.liveroom.R;

import android.content.Context;

public class AssetFileUtil {
	
	public static final String FILE_NAME_EMOJI = "emoji";
	
    public static List<String> getEmojiFile(Context context) {  
        try {  
            List<String> list = new ArrayList<String>();  
            InputStream in = context.getResources().getAssets().open(FILE_NAME_EMOJI);  
            BufferedReader br = new BufferedReader(new InputStreamReader(in,  
                    "UTF-8"));  
            String str = null;  
            while ((str = br.readLine()) != null) {  
                list.add(str);  
            }  
  
            return list;  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
        return null;  
    }
    
    public static List<String> getEmojiFileFromRaw(Context context){ 
    	try {
    		List<String> list = new ArrayList<String>();
    		InputStreamReader inputReader = new InputStreamReader(context.getResources().openRawResource(R.raw.test));
    		BufferedReader bufReader = new BufferedReader(inputReader);
    		String line="";
    		while((line = bufReader.readLine()) != null) {
    			list.add(line);
    		}
    		return list;
    	} catch (Exception e) { 
    		e.printStackTrace(); 
    	}
    	return null;
    } 
}
